package commands;

import java.util.HashMap;

import containers.StudentContainer;
import entities.Loan;
import entities.Student;

/**
 * command for setting up a brand new loan
 * 
 * @author Graham
 */
public class NewLoan {

	/**
	 * sets a newly applied(requested) for loan to a student
	 * 
	 * @param studentNum
	 *            , int, student num of student
	 * @param loanAmt
	 *            , double, amount of loan requested
	 */
	public NewLoan(int studentNum, double loanAmt) {
		HashMap<Integer, Student> students = StudentContainer.dictionary();

		if (students.containsKey(studentNum)) {
			Student student = students.get(studentNum);

			Loan myloan = new Loan(student);
			myloan.setAmountRequested(loanAmt);
			student.setLoan(myloan);

		}
	}

	/**
	 * @param args
	 */
	@SuppressWarnings("unused")
	public static void main(String[] args) {
		HashMap<Integer, Student> students = StudentContainer.dictionary();

		AddStudent myAddStudent = new AddStudent(new Student(0, ""));

		NewLoan myNewLoan = new NewLoan(0, 2000);
		Student student = students.get(0);

		if (student.getLoan().getAmountRequested() != 2000) {
			System.out.println("problem making a new loan");
		}

	}

}
